package Collection;

import java.util.*;

/**
 * @author wuhan
 * @date 2019/9/26 21:44
 *
 * Map<K,V>
 *     1.添加put(),putAll()
 *     2.删除  clear(),remoshve()
 *     3.判断containsKey,containsValue()，isEmpty(),
 *     4.获取 get,size(),value(),entrySet,keySet
 *hashTable
 * hashMap
 * TreeMap
 */

public class MapDemo {
    public static void main(String[] args) {
        HashMap<Student,String> hm=new HashMap<Student, String>();
        hm.put(new Student("wuhan",20),"北京");
        hm.put(new Student("ljy",20),"建阳");
        hm.put(new Student("ljy1",20),"上海");
        hm.put(new Student("ljy2",20),"南京");
        hm.put(new Student("ljy1",20),"上");

//        for (Map.Entry<Student, String> studentStringEntry : hm.entrySet()) {
//            System.out.println(studentStringEntry);
//        }
//
        Set<Student> students = hm.keySet();
        for (Student student : students) {
            System.out.print(student);
            System.out.println(hm.get(student));

        }



//        Map<String,String> map =new HashMap<>();
//        map.put("01","wuhan");
//        map.put("02","ljy");
//        map.put("03","lzy");
////        Set<String> strings = map.keySet();
////        for (String string : strings) {
////            System.out.println(string);
////        }
////        for (String string : strings) {
////            System.out.println(string);
////        }
//        Set<Map.Entry<String, String>> entries = map.entrySet();
//        for (Map.Entry<String, String> entry : entries) {
//            System.out.println(entry);
//        }

    }
}
